package com.sponsorpay.sdk.android.publisher.mbe;

import android.app.Activity;
import android.content.Intent;
import android.os.Build.VERSION;
import android.os.Bundle;
import android.view.Window;

public class SPBrandEngageActivity extends Activity
  implements SPBrandEngageClientStatusListener
{
  private boolean mPendingClose = false;

  private void closeActivity()
  {
    finish();
  }

  private void setResultAndClose(String paramString)
  {
    Intent localIntent = new Intent();
    localIntent.putExtra("ENGAGEMENT_STATUS", paramString);
    setResult(-1, localIntent);
    closeActivity();
  }

  public void didChangeStatus(SPBrandEngageClientStatusListener.SPBrandEngageClientStatus paramSPBrandEngageClientStatus)
  {
    switch ($SWITCH_TABLE$com$sponsorpay$sdk$android$publisher$mbe$SPBrandEngageClientStatusListener$SPBrandEngageClientStatus()[paramSPBrandEngageClientStatus.ordinal()])
    {
    default:
      return;
    case 2:
      setResultAndClose("CLOSE_FINISHED");
      return;
    case 3:
      setResultAndClose("CLOSE_ABORTED");
      return;
    case 5:
      setResultAndClose("ERROR");
      return;
    case 4:
    }
    this.mPendingClose = true;
  }

  public void didReceiveOffers(boolean paramBoolean)
  {
  }

  public void onBackPressed()
  {
    SPBrandEngageClient.INSTANCE.closeEngagement();
    super.onBackPressed();
  }

  protected void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    getWindow().requestFeature(1);
    getWindow().setFlags(1024, 1024);
    if ((Build.VERSION.SDK_INT == 9) || (Build.VERSION.SDK_INT == 10))
      setRequestedOrientation(0);
    SPBrandEngageClient.INSTANCE.setStatusListener(this);
    SPBrandEngageClient.INSTANCE.startEngagement(this);
  }

  protected void onDestroy()
  {
    SPBrandEngageClient.INSTANCE.setStatusListener(null);
    super.onDestroy();
  }

  protected void onPause()
  {
    super.onPause();
    if (!this.mPendingClose)
    {
      SPBrandEngageClient.INSTANCE.onPause();
      SPBrandEngageClient.INSTANCE.closeEngagement();
      closeActivity();
    }
  }

  protected void onResume()
  {
    super.onResume();
    if (this.mPendingClose)
      SPBrandEngageClient.INSTANCE.closeEngagement();
  }
}

/* Location:           E:\android\Toy Defense 2_dex2jar.jar
 * Qualified Name:     com.sponsorpay.sdk.android.publisher.mbe.SPBrandEngageActivity
 * JD-Core Version:    0.6.2
 */